import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import "./assets/styles/normalize.css";
import './index.css'

/* 路由相关，后续单独抽离出去 */
import { RouterProvider, createBrowserRouter, RouteProps, RouteObject } from "react-router-dom";
import { Login } from "./pages/login";
import { Register } from "./pages/register";
import { UpdatePassword } from "./pages/update-password";
import { ErrorPage } from "./pages/error";
import { UpdateInfo } from "./pages/update-info";
import { UserManager } from "./pages/user";
import { MeetingRoom } from "./pages/meeting-room";
import { BookingManage } from "./pages/booking-manage";
import { Statistics } from "./pages/statistics";

const routes: Array<any> = [
  {
    path: "/",
    element: <App></App>,
    errorElement: <ErrorPage />,
    children: [
      {
        path: "/",
        element: <MeetingRoom />
      },
      {
        path: "meeting_room",
        element: <MeetingRoom />
      },
      {
        path: "update_info",
        element: <UpdateInfo />
      },
      {
        path: "user_manager",
        element: <UserManager />
      },
      {
        path: "booking_manage",
        element: <BookingManage />
      },
      {
        path: "/statistics",
        element: <Statistics />
      }
    ]
  },
  {
    path: "login",
    element: <Login />
  },
  {
    path: "register",
    element: <Register />
  },
  {
    path: "update_password",
    element: <UpdatePassword />
  }
];

const router = createBrowserRouter(routes as Array<RouteObject>);

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <RouterProvider router={router} />
)
